package com.pdlocation.repository;

import androidx.lifecycle.MutableLiveData;

import com.pdlocation.model.LocationPoint;


//数据持有者类
public class DataRepository {
    private static DataRepository instance;
    private MutableLiveData<LocationPoint> dataLiveData;

    private DataRepository() {
        dataLiveData = new MutableLiveData<>();
    }

    public static synchronized DataRepository getInstance() {
        if (instance == null) {
            instance = new DataRepository();
        }
        return instance;
    }

    public MutableLiveData<LocationPoint> getDataLiveData() {
        return dataLiveData;
    }

    // 提供更新数据的方法
    public void updateData(LocationPoint data) {
        dataLiveData.setValue(data);
    }
}
